#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 11;
use lib 'tests/search';
use AIR2TestUtils;    # sets lib path
use AIR2::Searcher::Sources;
use AIR2::Searcher::Sources::Engine;
use Data::Dump qw( dump );
use JSON::XS;

SKIP: {

    if ( !AIR2TestUtils::search_env_ok() ) {
        skip "The search env does not look sane. Skipping all tests", 11; 
    }

    my $authz = AIR2TestUtils::dummy_authz();

    ok( my $searcher = AIR2::Searcher::Sources->new(), "new searcher" );

    # loop for profiling
    my $count = 0;
    while ( $count++ < 10 ) {
        ok( my $results = $searcher->do_search(
                {   q        => 'test',
                    auth_tkt => $authz,
                }
            ),
            "get results"
        );

        #diag("count=$count");

        #dump $results;
    }

}
